<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@page import="com.situ.web.entity.Student"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.css"/>
</head>
<body>
    <a href="${pageContext.request.contextPath }/student?method=getBanjiId" class="btn btn-success">添加</a><br>
    <form action="${pageContext.request.contextPath }/student?method=selectById" method="post" >
    	<input type="text" name="id">
    	<input type="submit" value="根据id查询" >
    </form><br> 
    <form action="${pageContext.request.contextPath }/student?method=search" method="post" >
    	<input type="text" name="searchName">
    	<input type="submit" value="模糊查询" >
    </form><br>
	<table class="table table-striped table-bordered table-hover table-condensed">
		<tr>
			<td>ID</td>
			<td>名字</td>
			<td>年龄</td>
			<td>性别</td>
			<td>班级</td>
			<td>删除</td>
			<td>修改</td>
		</tr>
		<c:forEach items="${list }" var="student">
			<tr>
					<td>${student.id }</td>
					<td>${student.name }</td>
					<td>${student.age}</td>
					<td>${student.gender }</td>
					<td>${student.banjiId }</td>
					<td><a href="javascript:void(0)" onclick="deleteById(${student.id })">删除</a></td>
					<td><a href="javascript:void(0)" onclick="selectById(${student.id })">修改</a></td>
				</tr>	
		</c:forEach>
	</table><br>
	 <a href="${pageContext.request.contextPath }/student?method=pageList" class="btn btn-success">分页</a><br>
		
</body>
	<script type="text/javascript">
		function deleteById(id){
			var isDel = confirm("您确定要删除吗？");
			if(isDel){
				location.href = "${pageContext.request.contextPath }/student?method=deleteById&id="+id;
			}
		}
		
		function selectById(id){
			var isDel = confirm("您确定要修改吗？");
			if(isDel){
				location.href = "${pageContext.request.contextPath }/student?method=selectById2&id="+id;
			}
		}
		
	</script>
</html>